﻿@using LCTMoodle.Models.ViewModels
@model Tuple<KhoaHocViewModel, List<KhoaHoc_ThanhVienViewModel>>
@{
    Layout = "~/Views/Shared/_Khung.cshtml";
    
    ViewData["SiteMap"] = new string[] 
    {
        "Trang chủ", "/",
        "Khóa học", "/KhoaHoc",
        Model.Item1.tenKhoaHoc, "/Nhom/" + Model.Item1.ma,
        "Danh sách thành viên", "/KhoaHoc_ThanhVien/DanhSachThanhVien/" + Model.Item1.ma
    };

    List<KhoaHoc_ThanhVienViewModel> khoaHoc_ThanhViens = Model.Item2;

    NguoiDungViewModel nguoiDung = Session["NguoiDung"] as NguoiDungViewModel;
    string quyen = ((Dictionary<int, string>)Session["Quyen"])[Model.Item1.ma];
    
    bool coTheXoaThanhVien;
    
    if (nguoiDung == null)
    {
        coTheXoaThanhVien = false;
    }
    else
    {
        coTheXoaThanhVien = quyen.IndexOf("|10|") != -1;
    }
}

<link href="~/Content/css/KhoaHoc_ThanhVien/DanhSachThanhVien.css" rel="stylesheet" />

<h2 class="title">
    Danh sách thành viên
</h2>
<ul class="danh-sach-thanh-vien">
    @foreach(LCTMoodle.Models.ViewModels.KhoaHoc_ThanhVienViewModel khoaHoc_ThanhVien in khoaHoc_ThanhViens)
    {
        <li class="muc-thanh-vien" data-value="@khoaHoc_ThanhVien.maThanhVien">
            <section class="thanh-vien">
                @khoaHoc_ThanhVien.tenThanhVien
            </section>
            <section class="ngay-tham-gia">
                @khoaHoc_ThanhVien.thoiDiemThamGia
            </section>
            <section class="nut-chuc-nang">
                <i class="pe-7s-config"></i>
                <ul>
                    @if (coTheXoaThanhVien)
                    {
                        <li>
                            <a class="xoa-thanh-vien" href="#">
                                Xóa thành viên
                            </a>
                        </li>
                    }
                </ul>
            </section>
        </li>
    }
</ul>

<script src="~/Content/script/KhoaHoc_ThanhVien/DanhSachThanhVien.js" type="text/javascript"></script>
<script type="text/javascript">
    maKhoaHoc = @Model.Item1.ma
</script>
